<?php
class Delivery_Model_DbTable_QueueSms
	extends Delivery_Model_DbTable_Abstract

{
	protected $_name = 'queue_sms';
	protected $_primary = 'idQueueSms';
	
	public function insert( $sms )
	{
		return parent::insert(		
			$this->_getData( $sms )
		);	
	}
	
	public function update( $sms )
	{
		return parent::update(
			$this->_getData( $sms ),
			array('idQueueSms = ?' => $sms->idQueueSms)		
		);
	}
	
	public function delete ( $sms )
	{
		return parent::delete(array('idQueueSms = ?' => $sms->idQueueSms));
	}
	
	public function getAll( $limit )
	{
		return $this->_db->fetchAll(
			$this->select()->limit($limit)
		);	
	}
	
	protected function _getData( $sms )
	{
		return array (
			'to'	=> $sms->to,
   			'text'	=> $sms->text,
   		);
	} 
	
	
}